package com.baseweb.webadmin.core.constants;

import java.util.ArrayList;
import java.util.List;

public enum ChannelType {
    TOP_CHANNEL(1001,"顶部栏目"), LEFT_CHANNEL(1002,"左边栏目"), BOTTOM_CHANNEL(1003,"底部栏目"),CEHUA_CHANNEL(1004,"策划师栏目"),
    ZHUCHI_CHANNEL(1005,"主持人栏目"),SHEYINGSHI_CHANNEL(1006,"摄影师栏目"),HUAZHUANGSHI_CHANNEL(1008,"化妆师栏目"),
    SHEXIANGSHI_CHANNEL(1007,"摄像师栏目");

    private int code;
    private String name;
    ChannelType(int code, String name){
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static List<ChannelType> getAllChannel(){
        List<ChannelType> result = new ArrayList<ChannelType>();
        for (ChannelType current : ChannelType.values())
        {
            result.add(current);
        }
        return result;
    }
    public static List<String> getAllChannelOpt(){
        List<String> list = new ArrayList<>();
        for (ChannelType current : ChannelType.values())
        {
            String string = current.getCode() +";"+ current.getName();
            list.add(string);
        }
        return list;
    }
    public static ChannelType getNameByCode(int code){
        List<ChannelType> allData = getAllChannel();
        for (ChannelType cur : allData){
            if (cur.getCode() == code){
                return cur;
            }
        }
        return null;
    }
  /*  public static void main(String[] args) {
        List<String> list = ChannelType.getAllChannelOpt();
        for (String  t:list
             ) {
            System.out.println(t.toString());
        }
    }*/
}
